<p class="breadcrumbs"><strong>You are here:</strong> &raquo; <a href="<?php echo $gene_uri ?>"><?php _e($gene_name) ?></a> &raquo; Drafts</p>

<h2>Drafts</h2>

<?php if (count($drafts) >= Gene::getSetting("maximum_drafts")): ?>
	<p class="warning"><strong>You have stored the maximum number of drafts allowed.</strong><br />You will not be able to save any more drafts until you remove some old drafts.</p>
<?php endif; ?>

<?php if (count($drafts)): ?>
	<form action="<?php echo Gene::makeLink(Gene::specialId('Drafts')) ?>" method="post">
	<table>
	<tr><th></th><th>Draft</th><th>Last Saved</th><th>Location</th></tr>
	<?php foreach ($drafts as $i): ?>
		<tr>
		<td>
		<input type="image" src="<?php echo $ui['images'] ?>delete.png" name="delete" value="<?php echo $i['draft_id'] ?>" alt="Delete" />
		<a href="<?php echo addArguments(Gene::makeLink(Gene::objectId($i['parent'])).'/new/'.$i['type'], array('draft' => $i['draft_id'])) ?>"><img src="<?php echo $ui['images'] ?>edit.png" alt="Edit" /></a>
		</td>
		<td><a href="<?php echo addArguments(Gene::makeLink(Gene::objectId($i['parent'])).'/new/'.$i['type'], array('draft' => $i['draft_id'])) ?>"><?php if ($i['title']): ?><?php echo _e($i['title']) ?><?php else: ?>(Untitled Draft)<?php endif; ?></a>
		<br /><?php echo truncate(strip_tags($i['content']), 200) ?></td>
		<td><?php echo makeDate($i['draft_time']) ?></td>
		<td><a href="<?php echo Gene::makeLink(Gene::objectId($i['parent'])) ?>"><?php _e($i['parent']['title']) ?></a></td>
		</tr>
	<?php endforeach; ?>
	</table>
	
	</form>
<?php else: ?>
	<p><em>You don't have any drafts at the moment.</em></p>
<?php endif; ?>